this._appSystem.connect('favorites-changed', Lang.bind(this, function(appSys) {
this._redisplay(false);
}));
- this._appMonitor.connect('changed', Lang.bind(this, function(monitor) {
+ this._appMonitor.connect('app-added', Lang.bind(this, function(monitor) {
+ this._redisplay(false);
+ }));
+ this._appMonitor.connect('app-removed', Lang.bind(this, function(monitor) {
this._redisplay(false);
}));
this._appSystem.connect('favorites-changed', Lang.bind(this, function(appSys) {
this._redisplay();
}));
- this._appMonitor.connect('changed', Lang.bind(this, function(monitor) {
+ this._appMonitor.connect('app-added', Lang.bind(this, function(monitor) {
+ this._redisplay();
+ }));
+ this._appMonitor.connect('app-removed', Lang.bind(this, function(monitor) {
this._redisplay();
}));
#include "shell-app-monitor.h"
#include "shell-app-system.h"
#include "shell-global.h"
+#include "shell-marshal.h"
#include "display.h"
#include "window.h"
};
enum {
- CHANGED,
+ APP_ADDED,
+ APP_REMOVED,
+ WINDOW_ADDED,
+ WINDOW_REMOVED,
STARTUP_SEQUENCE_CHANGED,
LAST_SIGNAL
gobject_class->finalize = shell_app_monitor_finalize;
- signals[CHANGED] = g_signal_new ("changed",
- SHELL_TYPE_APP_MONITOR,
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ signals[APP_ADDED] = g_signal_new ("app-added",
+ SHELL_TYPE_APP_MONITOR,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _shell_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ SHELL_TYPE_APP_INFO);
+ signals[APP_REMOVED] = g_signal_new ("app-removed",
+ SHELL_TYPE_APP_MONITOR,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _shell_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ SHELL_TYPE_APP_INFO);
+
+ signals[WINDOW_ADDED] = g_signal_new ("window-added",
+ SHELL_TYPE_APP_MONITOR,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _shell_marshal_VOID__BOXED_OBJECT,
+ G_TYPE_NONE, 2,
+ SHELL_TYPE_APP_INFO,
+ META_TYPE_WINDOW);
+ signals[WINDOW_REMOVED] = g_signal_new ("window-removed",
+ SHELL_TYPE_APP_MONITOR,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _shell_marshal_VOID__BOXED_OBJECT,
+ G_TYPE_NONE, 2,
+ SHELL_TYPE_APP_INFO,
+ META_TYPE_WINDOW);
signals[STARTUP_SEQUENCE_CHANGED] = g_signal_new ("startup-sequence-changed",
SHELL_TYPE_APP_MONITOR,
usage = get_app_usage_from_window (self, window);
- /* Ephemerally keep track of the number of windows open for this app,
- * when it switches between 0 and 1 we emit a changed signal.
+ /* Keep track of the number of windows open for this app, when it
+ * switches between 0 and 1 we emit an app-added signal.
*/
usage->window_count++;
if (usage->initially_seen_sequence == 0)
usage->initially_seen_sequence = ++self->initially_seen_sequence;
usage->last_seen = get_time ();
if (usage->window_count == 1)
- g_signal_emit (self, signals[CHANGED], 0);
+ g_signal_emit (self, signals[APP_ADDED], 0, app);
+
+ /* Emit window-added after app-added */
+ g_signal_emit (self, signals[WINDOW_ADDED], 0, app, window);
}
static void
/* Remove before emitting */
g_hash_table_remove (self->window_to_app, window);
+ g_signal_emit (self, signals[WINDOW_REMOVED], 0, app, window);
+
if (usage->window_count == 0)
{
usage->initially_seen_sequence = 0;
- g_signal_emit (self, signals[CHANGED], 0);
+ g_signal_emit (self, signals[APP_REMOVED], 0);
}
}